<?php
/**
 * file: upload.php
 * 使用文件上传FileUpload类，处理单个和多个文件上传
 */
require "fileupload.class.php";                      //加载文件上传类

$config = FileUploadConfig::defaultUploadConfig();
$config->allowtype = array_merge($config->allowtype, ["txt", "json", "data"]);
$up = new FileUpload($config); //实例化文件上传对象
$up->upload('myfile');

$labels = $_POST["label"];
$files = $up->getFileName();

$banchMarkItems = [];
for ($index = 0; $index < count($labels); $index++) {
    $item = new BanchMarkItem();
    $item->label = $labels[$index];
    $item->file = $files[$index];
    $banchMarkItems[] = $item;
}

$fileJson =  json_encode($banchMarkItems);

$destUrl = "http://phplearningloc/MyDemo/feeds-perf-banchmark/common-banchmark-proj/banckmark.html";
$destUrl .= "?objs=$fileJson";
header('Location:' . $destUrl);
//header("Location: http://www.baidu.com");

//echo '</pre>';

class BanchMarkItem {
    public $label;
    public $file;
}